package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
	"github.com/zhaocy/fyne-theme"
)

func main() {
	myApp := app.New()
	myApp.Settings().SetTheme(themex.Themex())
	myWin := myApp.NewWindow("window对象")

	lbl := widget.NewLabel("")

	// 监听键盘按键  字母是大写
	myWin.Canvas().SetOnTypedKey(func(ke *fyne.KeyEvent) {
		lbl.SetText(string(ke.Name))
	})

	// 字母是小写
	// myWin.Canvas().SetOnTypedRune(func(r rune) {
	// 	lbl.SetText(string(r))
	// })

	btn := widget.NewButton("剪贴板", func() {
		lbl.SetText(myWin.Clipboard().Content())
	})

	// 固定窗口大小
	myWin.SetFixedSize(true)

	myWin.SetContent(container.NewVBox(lbl, btn))
	myWin.Resize(fyne.NewSize(550, 450))
	myWin.ShowAndRun()
}
